import { IsInt, IsString, Max, Min } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

export class CreateUserDto {
  @IsString({
    message: '用户名必须存在',
  })
  @ApiProperty({
    description: '用户名',
    example: 'admin',
    required: true,
  })
  name: string;
  @IsInt({
    message: '必须是数字',
  })
  @Min(0, {
    message: '年龄必须在0-10之间,必须是数字',
  })
  @Max(10, {
    message: '年龄必须在0-10之间,必须是数字',
  })
  @ApiProperty({
    description: '年龄',
    example: 9,
    required: true,
  })
  age: number;
  @ApiProperty({
    description: '品种',
    example: '稀有品种',
    required: true,
  })
  @IsString({
    message: '品种不能为空',
  })
  breed: string;
}
